package com.googlecode.recycled.drools;

import com.google.common.collect.Sets;

import java.util.Collections;
import java.util.Set;

public class MemoryStoreFactHandler implements FactHandler, FactHandlerHistory {

    protected Set<Object> facts = Sets.newLinkedHashSet();

    @Override
    public void insert(Object fact) {
        facts.add(fact);
    }

    @Override
    public void retract(Object fact) {
        facts.remove(fact);
    }

    @Override
    public Iterable<Object> getFactsHistory() {
        return Collections.unmodifiableSet(facts);
    }

}
